﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DGM.Objects.General;
using DGM.Objects.Msmq;
using DGM.Objects.SocialMedia.Twitter;
using DGM.Util.Helpers.Google;
using DGM.Util.Helpers.Klout;
using DGM.Util.Helpers.Msmq;
using DGM.Util.Helpers.Twitter;
using DGM.Util.Helpers.UClassify;

namespace TestFormApplication
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            TwitterStreamHelper.StreamTrack("bieber", TweetCallback);
        }

        private void TweetCallback(Tweet tweet)
        {
            var text = tweet.Message;

           /* var gender = UClassifyHelper.AnaliseGender(text);

            var mood = UClassifyHelper.AnaliseMood(text);
            var sentiment = UClassifyHelper.AnaliseSentiment(text);

            var lang = UClassifyHelper.AnaliseLanguage(text);/**/

            string messageQueueName = @"MyQueue";

            MsmqManager.SendToQueue(QueueType.Private, messageQueueName, tweet, tweet.User.Screen_Name);
        }

        private void msmqCallback(ResultObject<Tweet> obj)
        {
            var text = obj.Data.Message;

            var gender = UClassifyHelper.AnaliseGender(text);

            var mood = UClassifyHelper.AnaliseMood(text);
            var sentiment = UClassifyHelper.AnaliseSentiment(text);

            //var lang = UClassifyHelper.AnaliseLanguage(text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string messageQueueName = @"MyQueue";

            MsmqManager.ListenToQueueAsync<Tweet>(QueueType.Private, messageQueueName, msmqCallback);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            var text = "http://www.news24.com/SouthAfrica/News/Cops-plead-not-guilty-in-toilet-rape-case-20120801";

            var gender = UClassifyHelper.AnaliseGender(text);

            var mood = UClassifyHelper.AnaliseMood(text);
            var sentiment = UClassifyHelper.AnaliseSentiment(text);

            var lang = UClassifyHelper.AnalyseLanguage(text);
        }

        
    }
}
